This invention relates to a computer, a resource usage calculation method, and a resource usage calculation program.
Each process (for example, business application) of a program (for example, Java application server) that is run on a virtual machine (for example, Java VM) is executed thread by thread. When threads are executed, memory areas (stack areas) dedicated for the individual threads and a memory area (heap area) shared by all the threads are used as needed. An unnecessary memory (object) is collected automatically by a garbage collection (hereinafter referred to as “GC”) function of the virtual machine.
There is known a technology of controlling a process which is executed in a thread in accordance with the memory usage in the process. The process that is executed in the thread includes a process that is executed in a thread alone, a process that is executed in the units of stack frames in a thread, and a process that is executed in a plurality of threads. However, a plurality of processes may use the same memory in an overlapping manner. Therefore, it is difficult to calculate the memory usage in each process executed in a thread.
Japanese Patent Application Laid-open No. 2009-110213 discloses a technology for solving this problem. The technology disclosed in Japanese Patent Application Laid-open No. 2009-110213 can roughly calculate a target memory usage in a specific function (process) which is executed in a thread, based on the remaining memory of the virtual machine at the start of the execution of the specific function and other functions that are executed at the same time as the specific function.